﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SitePagePopUp.Master" AutoEventWireup="true" CodeBehind="Chinh-Sua-Lich-Lam-Viec-Nhan-Vien.aspx.cs" Inherits="TranTekBE.KPI_NhanSu.Chinh_Sua_Lich_Lam_Viec_Nhan_Vien" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <!------------------------------>
<!--script auto complete ddl !-->
<!------------------------------>
     <style>
       .ui-button { margin-left: -1px; }
       .ui-button-icon-only .ui-button-text { padding: 0.35em; }
       .ui-autocomplete-input { margin: 0; padding: 0.48em 0 0.47em 0.45em; font:10px }
     </style>
 <!------------------------------>
 <!--End script auto complete ddl !-->
 <!------------------------------>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="BodyPopupContent" runat="server">
   <div style="border: 0px solid #000; padding: 10px;">
        <table cellpadding="2" cellspacing="1" border="0">
            <tr><td colspan="2"><asp:Label ID="lbErr" runat="server"></asp:Label></td></tr>
            <tr>
                <td align="right">Ngày: </td>
                <td>
                    <asp:Label runat="server" ID="lblNgayLamViec" Font-Bold="true"></asp:Label>
                </td>
            </tr>
            <tr>
                <td  align="right">Tên nhân viên: </td>
                <td>
                    <div class="demo">
                        <div class="ui-widget">
         
                            <asp:DropDownList ID="droplist_ten_nhan_vien" runat="server">
                            </asp:DropDownList>
   
                        </div>
                        <button id="toggle" style="display:none">Show underlying select</button>
                    </div>
                </td>
            </tr>
            <tr>
                <td  align="right">Ca làm việc: </td>
                <td>
                   <asp:RadioButtonList ID="radio_btn_ca" runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem Selected="True" Text="Ca 1" Value="1"></asp:ListItem>
                            <asp:ListItem Text="Ca 2" Value="2"></asp:ListItem>
                        </asp:RadioButtonList>
                </td>
            </tr>
            <tr>
                <td  align="right">Cửa hàng: </td>
                <td>
                   <asp:DropDownList ID="droplist_cua_hang_lam_viec" runat="server">
                        </asp:DropDownList>
                </td>

            </tr>
            
            <tr><td><br /></td></tr>
            <tr>
                <td colspan="2" align="center">
                    <asp:Button ID="btnEditEvent" runat="server" Text="Chấp Nhận Sửa" OnClick="btnEditEvent_Click" Width="200px" Height="50px" />
                </td>

            </tr>
        </table>
        
     
    </div>

    
<script type="text/javascript">
    //-----------------------------------------------
    //script auto complete ddl
    //-----------------------------------------------
    function optionSelected(selectedValue) {
        document.title = selectedValue;
    }

    (function ($) {
        $.widget("ui.combobox", {
            _create: function () {
                var self = this,
                           select = this.element.hide(),
                           selected = select.children(":selected"),
                           value = selected.val() ? selected.text() : "";
                var input = this.input = $("<input placeholder='Chọn tên nhân viên'>")
                           .insertAfter(select)
                           .val(value)
                           .autocomplete({
                               delay: 0,
                               minLength: 0,
                               source: function (request, response) {
                                   var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
                                   response(select.children("option").map(function () {
                                       var text = $(this).text();
                                       if (this.value && (!request.term || matcher.test(text)))
                                           return {
                                               label: text.replace(
                                                                    new RegExp(
                                                                           "(?![^&;]+;)(?!<[^<>]*)(" +
                                                                           $.ui.autocomplete.escapeRegex(request.term) +
                                                                           ")(?![^<>]*>)(?![^&;]+;)", "gi"
                                                                    ), "$1"),
                                               value: text,
                                               option: this
                                           };
                                   }));
                               },
                               select: function (event, ui) {
                                   ui.item.option.selected = true;
                                   self._trigger("selected", event, {
                                       item: ui.item.option
                                   });
                                   //JK
                                   optionSelected(ui.item.option.value);

                               },
                               change: function (event, ui) {
                                   if (!ui.item) {
                                       var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex($(this).val()) + "$", "i"),
                                                       valid = false;
                                       select.children("option").each(function () {
                                           if ($(this).text().match(matcher)) {
                                               this.selected = valid = true;
                                               return false;
                                           }
                                       });
                                       if (!valid) {
                                           // remove invalid value, as it didn't match anything
                                           $(this).val("");
                                           select.val("");
                                           input.data("autocomplete").term = "";
                                           return false;
                                       }
                                   }
                               }
                           })
                           .addClass("ui-widget ui-widget-content ui-corner-left");

                input.data("autocomplete")._renderItem = function (ul, item) {
                    return $("<li></li>")
                                  .data("item.autocomplete", item)
                                  .append("<a>" + item.label + "</a>")
                                   .appendTo(ul);
                };

                this.button = $("<button type='button'>&nbsp;</button>")
                           .attr("tabIndex", -1)
                           .attr("title", "Show All Items")
                           .insertAfter(input)
                           .button({
                               icons: {
                                   primary: "ui-icon-triangle-1-s"
                               },
                               text: false
                           })
                           .removeClass("ui-corner-all")
                           .addClass("ui-corner-right ui-button-icon")
                           .click(function () {
                               // close if already visible
                               if (input.autocomplete("widget").is(":visible")) {
                                   input.autocomplete("close");
                                   return;
                               }

                               // pass empty string as value to search for, displaying all results
                               input.autocomplete("search", "");
                               input.focus();
                           });
            },

            destroy: function () {
                this.input.remove();
                this.button.remove();
                this.element.show();
                $.Widget.prototype.destroy.call(this);
            }
        });
    })(jQuery);

    $(function () {
        $("#<%= droplist_ten_nhan_vien.ClientID%>").combobox();
        $("#toggle").click(function () {
            $("#<%= droplist_ten_nhan_vien.ClientID%>").toggle();
               });
    });
           //-----------------------------------------------
           //End script auto complete ddl
           //-----------------------------------------------

</script>
</asp:Content>
